package com.atguigu.spzx.util;

import com.atguigu.spzx.model.entity.system.SysUser;
import com.atguigu.spzx.model.entity.user.UserInfo;

/**
 * @author LT
 * @create 2024-03-10-16:35
 */
public class AuthContextUtil {

    //创建一个ThreadLocal对象
    private static final ThreadLocal<SysUser> SYSUSER_threadLocal = new ThreadLocal<>();

    //定义存储数据的静态方法
    public static void set(SysUser user){
        SYSUSER_threadLocal.set(user);
    }

    //定义获取数据的静态方法
    public static SysUser get(){
        return SYSUSER_threadLocal.get();
    }

    //定义删除数据的静态方法
    public static void remove(){
        SYSUSER_threadLocal.remove();
    }



    private static final ThreadLocal<UserInfo> UserInfo_threadLocal = new ThreadLocal<>();

    //定义存储数据的静态方法
    public static void set1(UserInfo userInfo){
        UserInfo_threadLocal.set(userInfo);
    }

    //定义获取数据的静态方法
    public static UserInfo get1(){
        return UserInfo_threadLocal.get();
    }

    //定义删除数据的静态方法
    public static void remove1(){
        UserInfo_threadLocal.remove();
    }








}
